/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package by.bsuir.bbs.persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Администратор
 */
@Embeddable
public class CommentPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "comment_id")
    private int commentId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ad_id_ad")
    private int adIdAd;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ad_user_iduser")
    private int adUserIduser;

    public CommentPK() {
    }

    public CommentPK(int commentId, int adIdAd, int adUserIduser) {
        this.commentId = commentId;
        this.adIdAd = adIdAd;
        this.adUserIduser = adUserIduser;
    }

    public int getCommentId() {
        return commentId;
    }

    public void setCommentId(int commentId) {
        this.commentId = commentId;
    }

    public int getAdIdAd() {
        return adIdAd;
    }

    public void setAdIdAd(int adIdAd) {
        this.adIdAd = adIdAd;
    }

    public int getAdUserIduser() {
        return adUserIduser;
    }

    public void setAdUserIduser(int adUserIduser) {
        this.adUserIduser = adUserIduser;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) commentId;
        hash += (int) adIdAd;
        hash += (int) adUserIduser;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CommentPK)) {
            return false;
        }
        CommentPK other = (CommentPK) object;
        if (this.commentId != other.commentId) {
            return false;
        }
        if (this.adIdAd != other.adIdAd) {
            return false;
        }
        if (this.adUserIduser != other.adUserIduser) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "by.bsuir.bbs.jpa.CommentPK[ commentId=" + commentId + ", adIdAd=" + adIdAd + ", adUserIduser=" + adUserIduser + " ]";
    }
    
}
